package written.test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @Author: Dang Qi
 * @Date: 2021/4/2  18:58
 * @Description:
 */
public class AlibabaQ1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        for(int i = 0; i < T; i++){
            int n = sc.nextInt();
            int[] arr = new int[n];
            for(int j = 0; j < n; j++){
                arr[j] = sc.nextInt();
            }
            System.out.println(cal(arr));
        }
    }
    public static int cal(int[] arr){
        if(arr.length <= 1) return arr.length;
        Set<Integer> set = new HashSet<>();
        set.add(arr[0]);
        for(int i = 1; i < arr.length; i++){
            if(set.contains(arr[i])){
                set.add(arr[i] + 1);
            }else {
                set.add(arr[i]);
            }
        }
        return set.size();
    }
}













